package com.java8.lambda.dome;

import java.util.ArrayList;
import java.util.List;

public class test7 {
    public static void master() {
        System.out.println("-----------------test7.master()-----------------");

        List<String> names = new ArrayList<>();
        names.add("悟空");
        names.add("悟能");
        names.add("悟净");
        names.add("唐僧");

        int size = names.size();
        for (int i = 0; i < size; i++) {
            System.out.println(names.get(i));
        }

        System.out.println("method 2-->");
        for (String name : names) {
            System.out.println(name);
        }


        System.out.println("method lambda-->");
        names.forEach((name) -> {
            System.out.println(name);
        });
    }
}
